unit fVisualPlugin;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, uHYVisualPlugin, StdCtrls, ActnList, uHYActions,
  StdActns;

type
  { TVisualForm }
  TVisualPlugin = class(THYVisualPlugin)
    Memo: TMemo;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private

  protected
  public
  end;

implementation

uses
  uHYPluginFactories, uHYIntf;

{$R *.dfm}

procedure Create_VisualPlugin(out anInstance: IInterface);
begin
  anInstance := TVisualPlugin.Create(NIL);
end;

procedure TVisualPlugin.Button1Click(Sender: TObject);
begin
  Memo.Lines.Add('It is now '+TimeToStr(Now))
end;

procedure TVisualPlugin.Button2Click(Sender: TObject);
var x : pointer;
begin
  x := NIL;
  try
    try
      ShowMessage(TObject(x).ClassName);
      ShowMessage('Cannot reach this point!');
    except
      on E:Exception do begin
        ShowMessage('Should reach this point!');
        raise
      end;
    end;
  finally
    ShowMessage('Should reach this point as well!');
  end;
end;

initialization
  THYPluginFactory.Create(HInstance, 'MyFirstVisualPlugin', Create_VisualPlugin, TVisualPlugin);

end.
